/*
 * @Date: 2024-11-18 15:11:23
 * @Author: LiSong
 * @LastEditors: g05047
 * @LastEditTime: 2025-01-14 19:35:17
 * @Description: 表单管理相关接口
 */
import { defAxios as request } from '@/utils/http';

export function useFormListApi() {
	return {
		delPrdFormInfo(params) {
			return request({
				url: '/prdFormInfo/delPrdFormInfo',
				method: 'post',
				data: params,
			});
		},
		updateStatus(params) {
			return request({
				url: '/prdFormInfo/updateStatus',
				method: 'post',
				data: params,
			});
		},
		copyPrdFormInfo(value) {
			return request({
				url: '/prdFormInfo/copyPrdFormInfo',
				method: 'POST',
				data: value,
			});
		}
	};
}

export function useFormDesignerApi() {
	return {
		/**
		 * 新增表单配置
		 *
		 * @param {Object} params 表单配置信息
		 * @returns axios
		 */
		addPrdFormInfo(params) {
			return request({
				url: '/prdFormInfo/addPrdFormInfo',
				method: 'POST',
				data: params,
			});
		},
		/**
		 * 通过表单id查询表单配置信息
		 *
		 * @param {String} value 表单ID
		 * @returns axios
		 */
		getPrdFormInfoByFormId(formId) {
			return request({
				url: '/prdFormInfo/queryPrdFormInfoListByFormId',
				method: 'GET',
				params: { formId },
			});
		},
		/**
		 * 通过表单id查询表单配置信息
		 *
		 * @param {String} value 表单编码
		 * @returns axios
		 */
		getPrdFormInfoByFormCode(formCode) {
			return request({
				url: '/prdFormInfo/queryPrdFormInfoListByFormCode',
				method: 'GET',
				params: { formCode },
			});
		},
	};
}
